.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?) }
  .nav-sidebar-inner-scroll
    .context-header
      = link_to admin_root_path, title: _('Admin Overview') do
        .avatar-container.s40.settings-avatar
          = sprite_icon('admin', size: 24)
        .sidebar-context-title
          = _('Admin Area')
    %ul.sidebar-top-level-items
      = nav_link(controller: %w(dashboard admin projects users groups jobs runners gitaly_servers), html_options: {class: 'home'}) do
        = link_to admin_root_path, class: 'shortcuts-tree' do
          .nav-icon-container
            = sprite_icon('overview')
          %span.nav-item-name
            = _('Overview')
        %ul.sidebar-sub-level-items
          = nav_link(controller: %w(dashboard admin projects users groups jobs runners gitaly_servers), html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_root_path do
              %strong.fly-out-top-item-name
                = _('Overview')
          %li.divider.fly-out-top-item
          = nav_link(controller: :dashboard, html_options: {class: 'home'}) do
            = link_to admin_root_path, title: _('Overview') do
              %span
                = _('Dashboard')
          = nav_link(controller: [:admin, :projects]) do
            = link_to admin_projects_path, title: _('Projects') do
              %span
                = _('Projects')
          = nav_link(controller: :users) do
            = link_to admin_users_path, title: _('Users') do
              %span
                = _('Users')
          = nav_link(controller: :groups) do
            = link_to admin_groups_path, title: _('Groups') do
              %span
                = _('Groups')
          = nav_link path: 'jobs#index' do
            = link_to admin_jobs_path, title: _('Jobs') do
              %span
                = _('Jobs')
          = nav_link path: ['runners#index', 'runners#show'] do
            = link_to admin_runners_path, title: _('Runners') do
              %span
                = _('Runners')
          = nav_link(controller: :gitaly_servers) do
            = link_to admin_gitaly_servers_path, title: 'Gitaly Servers' do
              %span
                = _('Gitaly Servers')

      = nav_link(controller: %w(system_info background_jobs logs health_check requests_profiles)) do
        = link_to admin_system_info_path do
          .nav-icon-container
            = sprite_icon('monitor')
          %span.nav-item-name
            = _('Monitoring')

        %ul.sidebar-sub-level-items
          = nav_link(controller: %w(system_info background_jobs logs health_check requests_profiles), html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_system_info_path do
              %strong.fly-out-top-item-name
                = _('Monitoring')
          %li.divider.fly-out-top-item
          = nav_link(controller: :system_info) do
            = link_to admin_system_info_path, title: _('System Info') do
              %span
                = _('System Info')
          = nav_link(controller: :background_jobs) do
            = link_to admin_background_jobs_path, title: _('Background Jobs') do
              %span
                = _('Background Jobs')
          = nav_link(controller: :logs) do
            = link_to admin_logs_path, title: _('Logs') do
              %span
                = _('Logs')
          = nav_link(controller: :health_check) do
            = link_to admin_health_check_path, title: _('Health Check') do
              %span
                = _('Health Check')
          = nav_link(controller: :requests_profiles) do
            = link_to admin_requests_profiles_path, title: _('Requests Profiles') do
              %span
                = _('Requests Profiles')

      = nav_link(controller: :broadcast_messages) do
        = link_to admin_broadcast_messages_path do
          .nav-icon-container
            = sprite_icon('messages')
          %span.nav-item-name
            = _('Messages')
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: :broadcast_messages, html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_broadcast_messages_path do
              %strong.fly-out-top-item-name
                = _('Messages')

      = nav_link(controller: [:hooks, :hook_logs]) do
        = link_to admin_hooks_path do
          .nav-icon-container
            = sprite_icon('hook')
          %span.nav-item-name
            = _('System Hooks')
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: [:hooks, :hook_logs], html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_hooks_path do
              %strong.fly-out-top-item-name
                = _('System Hooks')

      = nav_link(controller: :applications) do
        = link_to admin_applications_path do
          .nav-icon-container
            = sprite_icon('applications')
          %span.nav-item-name
            = _('Applications')
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: :applications, html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_applications_path do
              %strong.fly-out-top-item-name
                = _('Applications')

      = nav_link(controller: :abuse_reports) do
        = link_to admin_abuse_reports_path do
          .nav-icon-container
            = sprite_icon('slight-frown')
          %span.nav-item-name
            = _('Abuse Reports')
          %span.badge.badge-pill.count= number_with_delimiter(AbuseReport.count(:all))
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: :abuse_reports, html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_abuse_reports_path do
              %strong.fly-out-top-item-name
                = _('Abuse Reports')
              %span.badge.badge-pill.count.merge_counter.js-merge-counter.fly-out-badge= number_with_delimiter(AbuseReport.count(:all))

      - if akismet_enabled?
        = nav_link(controller: :spam_logs) do
          = link_to admin_spam_logs_path do
            .nav-icon-container
              = sprite_icon('spam')
            %span.nav-item-name
              = _('Spam Logs')
          %ul.sidebar-sub-level-items.is-fly-out-only
            = nav_link(controller: :spam_logs, html_options: { class: "fly-out-top-item" } ) do
              = link_to admin_spam_logs_path do
                %strong.fly-out-top-item-name
                  = _('Spam Logs')

      = nav_link(controller: :deploy_keys) do
        = link_to admin_deploy_keys_path do
          .nav-icon-container
            = sprite_icon('key')
          %span.nav-item-name
            = _('Deploy Keys')
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: :deploy_keys, html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_deploy_keys_path do
              %strong.fly-out-top-item-name
                = _('Deploy Keys')

      = nav_link(controller: :services) do
        = link_to admin_application_settings_services_path do
          .nav-icon-container
            = sprite_icon('template')
          %span.nav-item-name
            = _('Service Templates')
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: :services, html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_application_settings_services_path do
              %strong.fly-out-top-item-name
                = _('Service Templates')

      = nav_link(controller: :labels) do
        = link_to admin_labels_path do
          .nav-icon-container
            = sprite_icon('labels')
          %span.nav-item-name
            = _('Labels')
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: :labels, html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_labels_path do
              %strong.fly-out-top-item-name
                = _('Labels')

      = nav_link(controller: :appearances) do
        = link_to admin_appearances_path do
          .nav-icon-container
            = sprite_icon('appearance')
          %span.nav-item-name
            = _('Appearance')
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: :appearances, html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_appearances_path do
              %strong.fly-out-top-item-name
                = _('Appearance')

      = nav_link(controller: :application_settings) do
        = link_to admin_application_settings_path do
          .nav-icon-container
            = sprite_icon('settings')
          %span.nav-item-name
            = _('Settings')
        %ul.sidebar-sub-level-items.is-fly-out-only
          = nav_link(controller: :application_settings, html_options: { class: "fly-out-top-item" } ) do
            = link_to admin_application_settings_path do
              %strong.fly-out-top-item-name
                = _('Settings')

    = render 'shared/sidebar_toggle_button'
